package com.lzw.mall.common.mapper;

import com.lzw.mall.common.entity.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzw.mall.common.vo.CategoryVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lizhenwei
 * @since 2023-03-18
 */
public interface CategoryMapper extends BaseMapper<Category> {

    List<Category> selectListPage(String keyword);

    @Select("select * from category where parent_id=#{id}")
    List<Category> selectByParentId(Integer id);

    List<CategoryVO> indexList();

    @Select("select * from category where parent_id=#{id} order by sequence desc limit 0,8")
    List<Category> last8(Integer id);
}
